package com.xinyun.traceability.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    /**
     * 日期转换格式
     */
    public static final String DATE_FORMAT_PATTERN1 = "yyyy-MM-dd HH:mm:ss.SSS";
    public static final String DATE_FORMAT_PATTERN2 = "yyyy-MM-dd HH:mm:ss";
    public static final String DATE_FORMAT_PATTERN3 = "yyyy-MM-dd";

    /**
     * 日期转成字符串
     * @param date
     * @return
     */
    public static String date2String(Date date) {
        if (date == null) {
            return null;
        }
        return new SimpleDateFormat("yyyyMMddHHmmssSSS").format(date);
    }

}
